//定义一组学生
//输入学生信息
//输出学生信息
//输出学生个数，总分数，平均分，平均年龄
#include <stdio.h>
#include <string.h>

typedef struct Date
{
	int iYear;
	int iMonth;
	int iDay;
}Date;

typedef struct STU
{
	int iId;
	char caName[32];
	float fScore;
	Date born;
}STU;
/*
struct STU
{
	int iId;
	char caName[32];
	float fScore;
}studate={1,"hh",10};    //初始化
//相当于定义了一个全局变量 studate
//等同于 -->struct STU studate={1,"hh",10};
*/

int main(void)
{
	STU stu[3];
    int i=0;
    for(i=0;i<3;i++)
    {
        printf("请输入第%d个学生的ID、姓名、成绩、出生年月日:\n",i+1);
        scanf("%dT%s%f%d%d%d",&stu[i].iId, &stu[i].caName,&stu[i].fScore, &stu[i].born.iYear,&stu[i].born.iMonth,&stu[i].born.iDay);
        while(getchar()!='\n');
    }
    for(i=0;i<3;i++)
    {
	printf("id:%d,name:%s,score:%.2f\n\
born:%d-%d-%d\n", stu[i].iId, stu[i].caName
           , stu[i].fScore, stu[i].born.iYear
		   , stu[i].born.iMonth
		   , stu[i].born.iDay);
    }
    printf("总共有%d个学生\n总分数是%.2lf\n平均分是%.2lf\n平均年龄是%.2lf\n",i,stu[1].fScore+stu[2].fScore+stu[3].fScore,(stu[1].fScore+stu[2].fScore+stu[3].fScore)/i,(2019*3-stu[1].born.iYear-stu[2].born.iYear-stu[3].born.iYear)*1.0/i);
//	printf("ssssssss\
aaaaaaaaaa\n");

	return 0;
}
